﻿/*
 * This file is part of CommunitySettlers.
 *
 * CommunitySettlers is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.

 * CommunitySettlers is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.

 * You should have received a copy of the GNU General Public License
 * along with CommunitySettlers.  If not, see <http://www.gnu.org/licenses/>.
 * 
 * Author: Christoph Husse
 * 
 * Also checkout our homepage: http://communitysettlers.codeplex.com/
 */
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SettlersEngine
{
    internal class VisualObjectFactory : IVisualObjectFactory
    {
        private Exported.GameInstance m_Instance;

        public VisualObjectFactory(Exported.GameInstance inInstance)
        {
            if(inInstance == null)
                throw new ArgumentNullException();

            m_Instance = inInstance;
        }

        public IVisualObject CreateResource(RuntimeMap inParent, IResourceObject inResource)
        {
            return new ResourceStack(m_Instance, inResource);
        }

        public IVisualSizedObject CreateBuilding(RuntimeMap inParent, IBuildableObject inBuilding)
        {
            return new Building(m_Instance, inBuilding);
        }

        public IVisualObject CreateStatic(RuntimeMap inParent, IStaticObject inStatic)
        {
            throw new NotImplementedException();
        }

        public IVisualObject CreateMoveable(RuntimeMap inParent, IMovableObject inMovable)
        {
            IVisualObject result;

            switch (inMovable.Type)
            {
                case MoveableType.Carrier: result = new Settler(m_Instance, inMovable); break;
                default:
                    throw new ArgumentException();
            }

            return result;
        }

    }
}
